{template header}

<!--{if $webglobal['action']=='regcom'}-->

	<div id="positionBox">
		<div class="left">
			<a href="{WEBURLPATH}/index.php">首页</a>&gt;
			商家注册
		</div>
	</div>
	<div class="contentInfoBox">
		<div class="linetitle">商家注册</div>
		<div>商家注册后需要系统人工审核，审核通过后我们会在三个工作日内联系您，谢谢！</div>
		<div class="blankline"></div>
		<!--{if !empty($webglobal[CPM])}-->
			<div class="listulstyle">
				<ul>
					<!--{loop $webglobal[CPM] $tempvalue}-->
					<li class="fcolor">$tempvalue</li>
					<!--{/loop}-->
				</ul>
			</div>
			<div class="blankline"></div>
		<!--{/if}-->
		<script type="text/javascript" src="{WEBURLPATH}/javascript/jquery.linkagesel-min.js"></script>
		<script type="text/javascript" src="{WEBURLPATH}/javascript/district-all.js"></script>
		<script type="text/javascript" src="http://ditu.google.cn/maps/api/js?sensor=false"></script>
		<form method="post" name="regform" id="regform" enctype="multipart/form-data" action="{WEBURLPATH}/register.php?action=regcom&check">
		<table class="datatable" cellspacing="1">
			<tbody>
				<tr>
					<th width="40%">商家分类<span class="need"> *</span></th>
					<td width="60%">
						<select name="company_category_id">
							<option value="0">选择分类...</option>
							<!--{loop $webglobal[file_register][category] $categoryID $option}-->
							<option value="{$categoryID}"{if isset($webglobal['CPP']['company_category_id']) && $webglobal['CPP']['company_category_id']==$categoryID} selected="selected"{/if}>{$option[showName]}</option>
							<!--{/loop}-->
						</select>
					</td>
				</tr>
				<tr>
					<th>登录用户名<span class="need"> *</span></th>
					<td>
						<input type="text" name="username" size="32" value="{if isset($webglobal['CPP']['username'])}$webglobal['CPP']['username']{/if}" />
						<div>英文数字组成，必须以字母开头，4-15位</div>
					</td>
				</tr>
				<tr>
					<th>E-mail<span class="need"> *</span></th>
					<td>
						<input type="text" name="email" size="32" value="{if isset($webglobal['CPP']['email'])}$webglobal['CPP']['email']{/if}" />
					</td>
				</tr>
				<tr>
					<th>登录密码<span class="need"> *</span></th>
					<td>
						<input type="password" name="password" size="32" value="" />
						<div>长度不少于6位</div>
					</td>
				</tr>
				<tr>
					<th>重复登录密码<span class="need"> *</span></th>
					<td>
						<input type="password" name="passwordtwo" size="32" value="" />
					</td>
				</tr>
				<tr>
					<th>商家名称<span class="need"> *</span></th>
					<td>
						<input type="text" name="name" size="32" value="{if isset($webglobal['CPP']['name'])}$webglobal['CPP']['name']{/if}" />
						<div>中文和英文必填一项</div>
					</td>
				</tr>
				<tr>
					<th>商家别名<span class="need"> *</span></th>
					<td>
						<input type="text" name="english_name" size="32" value="{if isset($webglobal['CPP']['english_name'])}$webglobal['CPP']['english_name']{/if}" />
					</td>
				</tr>
				<tr>
					<th>商家logo</th>
					<td>
						<input type="file" name="logo" size="20" />
						<div>格式：jpg,gif,png</div>
					</td>
				</tr>
				<tr>
					<th>营业执照代码<span class="need"> *</span></th>
					<td>
						<input type="text" name="bcode" size="32" value="{if isset($webglobal['CPP']['bcode'])}$webglobal['CPP']['bcode']{/if}" />
					</td>
				</tr>
				<tr>
					<th>营业执照图片<span class="need"> *</span></th>
					<td>
						<input type="file" name="bcode_image" size="20" />
						<div>格式：jpg,gif,png，文件大小不超过2M</div>
					</td>
				</tr>
				<tr>
					<th>所属商圈<span class="need"> *</span></th>
					<td>
						<!-- area_id,province,city,district -->
						<input type="hidden" name="area_id" id="area_id" />
						<select name="area" id="area">
						</select>
						<input type="hidden" name="area_info" id="area_info" value="" />
					</td>
				</tr>
				<tr>
					<th>商家电话<span class="need"> *</span></th>
					<td>
						<input type="text" name="tel" size="40" value="{if isset($webglobal['CPP']['tel'])}$webglobal['CPP']['tel']{/if}" />
					</td>
				</tr>
				<tr>
					<th>商家网址</th>
					<td>
						<input type="text" name="site" size="40" value="{if isset($webglobal['CPP']['site'])}$webglobal['CPP']['site']{/if}" />
					</td>
				</tr>
				<tr>
					<th>商家地址<span class="need"> *</span></th>
					<td>
						<input type="text" name="address" id="address" size="40" value="{if isset($webglobal['CPP']['address'])}$webglobal['CPP']['address']{/if}" />
						<div>请正确填写商家地址，帮助地图精确定位</div>
					</td>
				</tr>
				<tr>
					<th>商家google地图</th>
					<td>
						<!-- latitude 纬度,longitude 经度 -->
						<input type="hidden" name="latitude" id="input_latitude" value="0" />
						<input type="hidden" name="longitude" id="input_longitude" value="0" />
						<input type="button" class="btn" style="" value="标注坐标" onclick="mark_map();" id="mark_map_button" />
						<input type="button" value="清除新坐标" class="btn" onclick="mark_clear();" id="mark_clear_button" style="display:none;" />
						<br /><div id="mark_map_info_new" style="margin-top:10px;color:red;"></div>
						<div id="map_canvas_edit" style="width:200px; height:100px; display: none;"></div>
					</td>
				</tr>
				<tr>
					<th>商家介绍<span class="need"> *</span></th>
					<td>
						<textarea id="description" name="description" style="width:450px;height:300px;">{if isset($webglobal['CPP']['description'])}$webglobal['CPP']['description']{/if}</textarea>
					</td>
				</tr>
				
			</tbody>
			<tfoot>
				<tr><th></th><td>
					<button type="submit">注册申请</button>
				</td></tr>
			</tfoot>
		</table>
		</form>
		<script type="text/javascript">
			var cur_latitude =0;
			var cur_longitude = 0;
			var cur_default_latlng = new google.maps.LatLng(35.22354439383212, 103.93229484558105);
			var cur_default_zoom = 4;
			var map;
			var new_marker;
			function map_initialize(latlng, zoom)
			{
				$("#map_canvas_edit").show();
				var myOptions = {
						zoom: zoom,
						center: latlng,
						mapTypeControl: false,
						//navigationControl: false,
						streetViewControl: false,
						mapTypeId: google.maps.MapTypeId.ROADMAP
					};
				map = new google.maps.Map(document.getElementById("map_canvas_edit"), myOptions);
			}
			function mark_map()
			{
				$("#map_canvas_edit").width(450).height(400);
				map_initialize(cur_default_latlng, cur_default_zoom);
				codeAddress();
				google.maps.event.addListener(map, 'click', function(event){addMarker(event.latLng);});
				mark_clear();
				$("#mark_map_info_new").html('(点击地图设定新坐标)');
				$("#mainMiddle").height($(document).height()-129);
			}
			function addMarker(location)
			{
				if (new_marker)
				{
					new_marker.setMap(null);
				}
				var new_latitude = location.lat();
				var new_longitude = location.lng();
				new_marker = new google.maps.Marker({position: location,map: map});
				$("#input_latitude").val(new_latitude);
				$("#input_longitude").val(new_longitude);
				$("#mark_clear_button").show();
				$("#mark_map_info_new").html('(新坐标 纬度：'+new_latitude+'，经度：'+new_longitude+')');
			}
			function mark_clear()
			{
				if (new_marker)
				{
					new_marker.setMap(null);
				}
				$("#input_latitude").val(cur_latitude);
				$("#input_longitude").val(cur_longitude);
				$("#mark_clear_button").hide();
				$("#mark_map_info_new").html('');
			}
			function codeAddress()
			{
				var address = $('#area_info').val()+$('#address').val();
				if (address == '')
				{
					return;
				}
				
				var geocoder = new google.maps.Geocoder();
				geocoder.geocode({'address': address}, function(results, status) {
					if (status == google.maps.GeocoderStatus.OK)
					{
						map.setCenter(results[0].geometry.location);
						map.setZoom(16);
						var search_marker = new google.maps.Marker({
										map: map, 
										position: results[0].geometry.location,
										icon: WEBURLPATH+'/images/mapflag.png'
									});
						var infowindow = new google.maps.InfoWindow({maxWidth: 200, content: '系统根据当前地址模糊定位到此，请点击地图设定确切位置，只有点击后设定才生效，当前标记仅作参考。'});
						infowindow.open(map, search_marker);
					}
				});
			}

			
			$(document).ready(function(){
				var areaData = '{$webglobal[file_register][area_json]}';
				var areaData = eval('(' + areaData + ')');
				/*alert (areaData);
				var opts = {
						data: areaData,
						selStyle: 'margin-left: 3px;',
						select: ['#area'],
						//defVal: [{$webglobal[file_register][area_tree]}]
				};
				var linkageSel = new LinkageSel(opts);
				areaData = opts = null; // 如果数据量大最好在创建LinkageSel实例之后清空

				linkageSel.onChange(function() {
					var input = $('#area_id');
					var lastselect = linkageSel.getSelectedValue();
					input.val(lastselect);
					var input1 = $('#area_info'),
						d = this.getSelectedDataArr('name'),
						arr = [];
					for (var i = 0, len = d.length; i < len; i++) {
						arr.push(d[i]);
					}
					input1.val(arr.join(''));
				});
				*/
				var opts = {
						data: areaData,
						selStyle: 'margin-left: 3px;',
						select:  '#area'
				};
				var linkageSel2 = new LinkageSel(opts);
				areaData = opts = null;	// 如果数据量大最好在创建LinkageSel实例之后清空
				
				
				linkageSel2.onChange(function() {
					var input = $('#area_id');
					var lastselect = linkageSel2.getSelectedValue();
					input.val(lastselect);
					var input1 = $('#area_info'),
						d = this.getSelectedDataArr('name'),
						arr = [];
					for (var i = 0, len = d.length; i < len; i++) {
						arr.push(d[i]);
					}
					input1.val(arr.join(''));
				});
			});
		</script>
	</div>
	<div class="couponRight">
		
	</div>
<!--{else}-->

	<div id="positionBox">
		<div class="left">
			<a href="{WEBURLPATH}/index.php">首页</a>&gt;
			个人注册
		</div>
	</div>
	<div class="contentInfoBox">
		<div class="linetitle">个人注册</div>
		<div>注册成功后系统会发送一封激活邮件到您的E-mail邮箱，激活后才能登录享受本站的服务。</div>
		<div class="blankline"></div>
		<!--{if !empty($webglobal[err_message])}-->
			<div class="listulstyle">
				<ul>
					<!--{loop $webglobal[err_message] $tempvalue}-->
					<li class="fcolor">$tempvalue</li>
					<!--{/loop}-->
				</ul>
			</div>
			<div class="blankline"></div>
		<!--{/if}-->
		<form method="post" name="regform" id="regform" action="{WEBURLPATH}/register.php?check">
		<table class="datatable" cellspacing="1">
			<tbody>
				<tr>
					<th>E-mail</th>
					<td>
						<input type="text" name="email" size="32" value="{if isset($webglobal['CPP']['email'])}$webglobal['CPP']['email']{/if}" />
						<div>E-mail地址用于激活帐号、找回密码以及登录等</div>
					</td>
				</tr>
				<tr>
					<th>你的昵称</th>
					<td>
						<input type="text" name="nickname" size="32" value="{if isset($webglobal['CPP']['nickname'])}$webglobal['CPP']['nickname']{/if}" />
						<div>不超过7个汉字或14个英文，数字、_和-</div>
					</td>
				</tr>
				<tr>
					<th>输入密码</th>
					<td>
						<input type="password" name="password" size="32" value="" />
						<div>不少于6位</div>
					</td>
				</tr>
				<tr>
					<th>重复密码</th>
					<td>
						<input type="password" name="passwordtwo" size="32" value="" />
					</td>
				</tr>
			</tbody>
			<tfoot>
				<tr><th></th><td>
					<button type="submit">立即注册</button>
				</td></tr>
			</tfoot>
		</table>
		</form>
	</div>
	<div class="couponRight">
		
	</div>

<!--{/if}-->

{template footer}